﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCEmailList.ascx.cs"
    Inherits="RedHouse.AdminControl.UserControls.Customer.UCEmailList" %>
<script type="text/javascript">
    function deleteEmail(id) {
        if (confirm("Are you sure to delete this email?")) {
            $.ajax({
                type: "POST",
                url: "Customer.aspx/DeleteEmail",
                data: "{'id': '" + id + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    alert('delete successfully');
                    location.replace('customer.aspx?action=1');
                },
                error: function (data) {
                    alert('delete successfully');
                }
            })
        }
    };
</script>
<asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="EmailItem">
    <LayoutTemplate>
        <table>
            <thead>
                <tr>
                    <th>
                        <input type="checkbox" class="checkall" />
                    </th>
                    <th>
                        Email
                    </th>
                    <th>
                        Date
                    </th>
                    <th>
                        Actions
                    </th>
                </tr>
            </thead>
            <asp:PlaceHolder runat="server" ID="EmailItem"></asp:PlaceHolder>
        </table>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <input type="checkbox" />
            </td>
            <%--  <td>
                <%#DataBinder.Eval(Container.DataItem,"Index")%>
            </td>--%>
            <td>
                <%#DataBinder.Eval(Container.DataItem,"Email")%>
            </td>
            <td>
                <%#DataBinder.Eval(Container.DataItem,"CreatedDate")%>
            </td>
            <td>
                <a href="#"><a href="#" onclick="javascript:deleteEmail('<%#DataBinder.Eval(Container.DataItem,"Id")%>');">
                    <img src="../../assets/action_delete.png" alt="Delete" /></a> <a href="#" onclick="javascript:edit('<%#DataBinder.Eval(Container.DataItem,"Id")%>');">
                        <img class="css-edit" src="../../assets/action_edit.png" alt="edit" /></a>
            </td>
        </tr>
    </ItemTemplate>
</asp:ListView>
<asp:DataPager runat="server" ID="DataPagerEmails" PageSize="25" PagedControlID="ListView1"
    OnPreRender="DataPagerEmails_PreRender">
    <Fields>
        <asp:TemplatePagerField>
            <PagerTemplate>
                &nbsp;
                <asp:TextBox ID="CurrentRowTextBox" runat="server" AutoPostBack="true" Text="<%# Container.StartRowIndex + 1%>"
                    Columns="1" Style="text-align: right" OnTextChanged="CurrentRowTextBox_OnTextChanged" />
                to
                <asp:Label ID="PageSizeLabel" runat="server" Font-Bold="true" Text="<%# Container.StartRowIndex + Container.PageSize > Container.TotalRowCount ? Container.TotalRowCount : Container.StartRowIndex + Container.PageSize %>" />
                of
                <asp:Label ID="TotalRowsLabel" runat="server" Font-Bold="true" Text="<%# Container.TotalRowCount %>" />
            </PagerTemplate>
        </asp:TemplatePagerField>
        <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="true"
            FirstPageText="|<< " LastPageText=" >>|" NextPageText=" > " PreviousPageText=" < " />
    </Fields>
</asp:DataPager>
<div style="float:right">
    <a style="vertical-align: middle; margin-right: 10px; margin-top: 7px;">Page Size</a>
    <asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged" Style="width: 70px !important;" />
</div>
